#include "Globals.h"

  extern TREG reg    = { 0 };
  extern TROM cpu    = { 0 };
  extern COMP cmp    = { 0 };
  extern FILE *rf    = { 0 };
  extern FILE *df    = { 0 };

  extern char romf[512] = { 0 };
  extern char txtf[512] = { 0 };
  extern char dirc[512] = { 0 };
  extern char cur_dir[MAXPATH] = { 0 };  
  extern LONG Start     = 0;
  extern LONG End       = 0;

//-----------------------------//
// Load the program data Bank  //
//-----------------------------//
LONG Snes2Pc( LONG ofs )
{
  LONG val;

  if ( !ofs ) return 0;

  return ( (ofs | 0xC00000) - 0xC00000 );
}// END OF SUB



//-----------------------------//
// Get the length of the file  //
//-----------------------------//
LONG FileSize( FILE *tf )
{
  LONG val,
	  		offset;

  // Test file
  if ( !tf )  return -1;

  // Get size
  offset = ftell( tf );
  fseek( tf, 0, SEEK_END );
  val    = ftell( tf );
  fseek( tf, offset, SEEK_SET );

 return val;
}// END OF SUB


//----------------------//
//                      //
//----------------------//
int  LoadTagData( FILE *tf )
{
  char buf[512];
  //
  while( fgets(buf, 255, tf) )
  { // Find a TAG string
    if ( !strncmpi( buf, ".COMP", 5 ) )
    { // Load te structure with info!
      sscanf( buf,
              "%s %s %s %X %X",
              &buf[256],
              &romf,
              &txtf,
              &Start,
              &End
            );
       //
       return 0;
     }
  }

  return -1;
}


